<template>
	<view class="content">
		<view class="title">选择地区</view>
		<view class="info-block">
			<view class="info-list" v-for="(item,index) in list" :key="item.id" @click="change(item)"
				:class="tabActive==item.id? 'active' :''">
				<view class="name" @click="switchTo(`/pages/index/index?id=${item.id}&value=${item.value}`)">
					{{item.value}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabActive: 1,
				list: [{
						id: 1,
						value: '酒泉市'
					},
					{
						id: 2,
						value: '肃州区'
					},
					{
						id: 3,
						value: '玉门市'
					},
					{
						id: 4,
						value: '瓜州县'
					},
					{
						id: 5,
						value: '敦煌市'
					},
					{
						id: 6,
						value: '肃北县'
					},
					{
						id: 7,
						value: '阿克塞县'
					},
					{
						id: 8,
						value: '金塔县'
					}
				]
			}
		},
		methods: {
			switchTo(url) {
				uni.reLaunch({
					url
				});
			},
			change(e) {
				this.tabActive = e.id
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		padding: 30rpx;

		.title {
			font-weight: bold;
			font-size: 34rpx;
			border-bottom: 1px solid #eee;
			padding-bottom: 30rpx;
		}

		.info-block {
			width: 100%;
			padding-top: 20rpx;
			display: flex;
			flex-direction: row;
			align-items: center;
			flex-wrap: wrap;
			border-bottom: 1px solid #eee;

			.info-list {
				width: calc((100% - 60rpx) / 3);
				text-align: center;
				border: 1px solid #2A8CFD;
				margin-right: 30rpx;
				margin-bottom: 30rpx;
				padding: 10rpx 16rpx;
				border-radius: 6rpx;

				.title {}
			}

			.info-list.active {
				background-color: #2A8CFD;
				color: #fff;
			}

			.info-list:nth-child(3n) {
				margin-right: 0rpx;
			}
		}
	}
</style>